// JavaScript Document
var signIn = {
	login: function (loginName, password) {
		var data = { loginName: loginName, password: password };
		$.commonAjax({
			url: 'B007',
			type: 'POST',
			data: data,
			isShowError: true,
			success: function (res) {
				$.layermsg(res.msg);
				if (res.code == 200) {
					$.ls('bp_token', res.data.token);
					$.ls('bp_memberCode', res.data.member.code);
					$.ls('bp_checkcode', res.data.member.id);
					$.ls('bp_name',res.data.member.nickName?res.data.member.nickName:res.data.member.telephone);
					var url = $.getSession('jump_url')?$.getSession('jump_url'):'my.html';
					$.deleteSession('jump_url');
					bp.jump(url);
				}
			}, error: function (res) {
				$.layermsg(res.msg);
			}
		});
	}
}
$(function () {
	$('#btn_sub').click(function () {
		var loginName = $('input[name="loginName"]').val();
		var password = $('input[name="password"]').val();
		if (bp.check_mobile(Number(loginName))) {
			if (password.length >= 6) {
				signIn.login(loginName, password);
			} else {
				$.alert('密码长度不正确!');
			}
		}
	});


})